forked from elderfo/react-native-storybook-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request elderfo#5 from Naturalclar/decorator
Add Sample Actionsheet page
- Loading branch information
Showing
6 changed files
with
94 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module "@expo/samples" { | ||
function ActionSheetProvider(): any; | ||
function connectActionSheet(): any; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import * as React from "react"; | ||
import { View, Text, TouchableOpacity } from "react-native"; | ||
import { connectActionSheet } from "@expo/react-native-action-sheet"; | ||
|
||
interface Props { | ||
showActionSheetWithOptions: ( | ||
options: any, | ||
buttonIndex: (index: number) => void | ||
) => void; | ||
} | ||
|
||
const MyPageScreen = ({ showActionSheetWithOptions }: Props) => { | ||
const onOpenActionSheet = () => { | ||
const options = ["Foo", "Bar", "Cancel"]; | ||
const okButtonIndex = 0; | ||
const destructionButtonIndex = 1; | ||
const cancelButtonIndex = 2; | ||
|
||
showActionSheetWithOptions( | ||
{ | ||
options, | ||
cancelButtonIndex | ||
}, | ||
buttonIndex => { | ||
switch (buttonIndex) { | ||
case cancelButtonIndex: | ||
break; | ||
case okButtonIndex: | ||
break; | ||
case destructionButtonIndex: | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
); | ||
}; | ||
return ( | ||
<View> | ||
<TouchableOpacity onPress={onOpenActionSheet}> | ||
<Text>Hello World!</Text> | ||
</TouchableOpacity> | ||
</View> | ||
); | ||
}; | ||
|
||
MyPageScreen.navigationOptions = { | ||
title: "MyPage" | ||
}; | ||
|
||
export default connectActionSheet(MyPageScreen); |
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