- Features
- Built With
- Pending Items
- Screenshot (iOS)
- Screenshot (Android)
- Getting Started
- Props
- Example App
- Building & Publishing
- Changelog
- ✅ iOS/Android
- ✅ Dark Mode
- ✅ Built with TypeScript
- ✅ Built with React Hooks
- ✅ Lightweight (0 Third Party Libraries)
- TypeScript - Programming Language
- React Hooks - Functional Component State/Lifecycle Methods
- React Native - Mobile (iOS/Android) Framework
- [ ]
Bottom Sheet
Form Sheet
1. Install Package:
npm i react-native-slide-modal
2. Add Example Code:
// Imports: Dependencies
import React, { useState } from 'react';
import { Button, Text } from 'react-native';
import { SlideModal } from 'react-native-slide-modal';
// App
const App: React.FC = (): JSX.Element => {
// React Hooks: State
const [ modalVisible, setModalVisible ] = useState<boolean>(false);
return (
<SlideModal
modalType="iOS Form Sheet"
// modalType="iOS Bottom Sheet"
modalVisible={modalVisible}
screenContainer={
<>
<Button
title="Show Modal"
onPress={() => setModalVisible(!modalVisible)}
/>
</>
}
modalContainer={
<>
<Text>Modal Content</Text>
</>
}
modalHeaderTitle="Header Title"
pressDone={() => setModalVisible(!modalVisible)}
pressCancel={() => setModalVisible(!modalVisible)}
darkMode={false}
doneDisabled={false}
/>
);
};
// Exports
export default App;
3. Run Project:
Android
react-native run-android
iOS
react-native run-ios
Default:
Property | Type | Default | Description |
---|---|---|---|
screenContainer |
JSX.Element |
<></> |
Screen content |
modalContainer |
JSX.Element |
<></> |
Modal content |
modalType |
ModalType |
'iOS Bottom Sheet' |
Modal slide type ('iOS Bottom Sheet' or 'iOS Form Sheet') |
modalVisible |
boolean |
false |
Modal visible |
pressCancel |
() => void |
undefined |
onPress for Cancel button |
pressDone |
() => void |
undefined |
onPress for Done button |
doneDisabled |
boolean |
false |
Disable Done button |
Optional:
Property | Type | Default | Description |
---|---|---|---|
darkMode |
boolean |
false |
Dark mode |
modalHeaderTitle |
string |
'' |
Modal header title |
customStyleContainer |
ContainerStyle |
iOS Theme | Styling for container |
customStyleModalHeaderContainer |
ModalHeaderContainerStyle |
iOS Theme | Styling for modal header container |
customStyleCancelText |
CancelTextStyle |
iOS Theme | Styling for cancel text |
customStyleDoneText |
DoneTextStyle |
iOS Theme | Styling for done text |
customStyleModalContentContainer |
ModalContentContainerStyle |
iOS Theme | Styling for modal content container |
customStylePickerItemText |
PickerItemTextStyle |
iOS Theme | Styling for picker item text |
1. Open Example App:
cd ExampleApp
2. Run Simulator:
Android
react-native run-android
iOS
react-native run-ios
Build
npm run build
Publish
npm publish
Removed
- Removed
react-native-typescript-transformer
as dependency.
Added
- Added
assets
to exclude intsconfig.json
.
Changed
- Updating
tsconfig.json
. - Updating
peerDependencies
inpackage.json
.
Removed
- Removed
types
to exclude intsconfig.json
.
Added
- Added Props section to
README
. - Added Example App section to
README
.
Changed
- Changed file structure.
- Changed
index.js
toindex.tsx
. - Changed
package.json
build script tocd src && tsc && cp ../package.json && Echo Build completed!
.
Removed
- Removed
yalc
as a global dependency.
Added
- Added
yalc
as a global dependency, soyalc publish
can be used.
Changed
- Changed
inlineRequires: true
toinlineRequires: false
inmetro.config.js
.
Changed
- Changed
compilerOptions.jsx
fromreact
toreact-jsx
.
Removed
- Removed
import React from 'react'
.
Changed
- Changing
"lib": ["es2017"]
to"lib": ["es2015"]
intsconfig.json
.
Changed
- Changing import from
import React from 'react';
toimport * as React from 'react';
.
Changed
- Updated NPM
dependencies
.
Changed
- Changed
alignContent
fromreact
toalignItems
. - Changed
compilerOptions.jsx
fromreact
toreact-jsx
.
Changed
- Changed
compilerOptions.jsx
fromreact-jsx
toreact
.
Changed
- Added
@types/react
asdevDependencies
.
Changed
- Changed
compilerOptions.jsx
fromreact-native
toreact-jsx
.
Changed
- Updated
typescript
.
Added
- Added
react
andreact-native
as dependencies.
Added
- Added
README
screenshots.
Added
- Added
README
example code.
Added
- Added
SlideModal
component (iOS Bottom Sheet
,iOS Form Sheet
).