-
Notifications
You must be signed in to change notification settings - Fork 952
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(components): add modal live examples
- Loading branch information
Artur Yorsh
committed
Nov 29, 2019
1 parent
0759295
commit fdfbcbe
Showing
6 changed files
with
113 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/playground/src/components/showcases/modal/modalSimpleUsage.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
import { StyleSheet } from 'react-native'; | ||
import { | ||
Button, | ||
Layout, | ||
Modal, | ||
Text, | ||
} from 'react-native-ui-kitten'; | ||
|
||
export const ModalSimpleUsageShowcase = () => { | ||
|
||
const [visible, setVisible] = React.useState(false); | ||
|
||
const toggleModal = () => { | ||
setVisible(!visible); | ||
}; | ||
|
||
const renderModalElement = () => ( | ||
<Layout | ||
level='3' | ||
style={styles.modalContainer}> | ||
<Text>Hi! This is modal</Text> | ||
<Button onPress={toggleModal}> | ||
DISMISS | ||
</Button> | ||
</Layout> | ||
); | ||
|
||
return ( | ||
<Layout style={styles.container}> | ||
<Button onPress={toggleModal}> | ||
TOGGLE MODAL | ||
</Button> | ||
<Modal visible={visible}> | ||
{renderModalElement()} | ||
</Modal> | ||
</Layout> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
minHeight: 256, | ||
padding: 16, | ||
}, | ||
modalContainer: { | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
width: 256, | ||
padding: 16, | ||
}, | ||
}); |
56 changes: 56 additions & 0 deletions
56
src/playground/src/components/showcases/modal/modalWithBackdrop.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from 'react'; | ||
import { StyleSheet } from 'react-native'; | ||
import { | ||
Button, | ||
Layout, | ||
Modal, | ||
Text, | ||
} from 'react-native-ui-kitten'; | ||
|
||
export const ModalWithBackdropShowcase = () => { | ||
|
||
const [visible, setVisible] = React.useState(false); | ||
|
||
const toggleModal = () => { | ||
setVisible(!visible); | ||
}; | ||
|
||
const renderModalElement = () => ( | ||
<Layout | ||
level='3' | ||
style={styles.modalContainer}> | ||
<Text>Hi! This is modal.</Text> | ||
</Layout> | ||
); | ||
|
||
return ( | ||
<Layout style={styles.container}> | ||
<Button onPress={toggleModal}> | ||
TOGGLE MODAL | ||
</Button> | ||
<Modal | ||
allowBackdrop={true} | ||
backdropStyle={styles.backdrop} | ||
onBackdropPress={toggleModal} | ||
visible={visible}> | ||
{renderModalElement()} | ||
</Modal> | ||
</Layout> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
minHeight: 256, | ||
padding: 16, | ||
}, | ||
modalContainer: { | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
width: 256, | ||
padding: 16, | ||
}, | ||
backdrop: { | ||
backgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
}, | ||
}); |