@rogermiret/react-native-prompt
v0.1.4
Published
React Native Prompt
Downloads
1
Readme
React Native Prompt
This package helps you to use Prompt Dialog cross platform iOS(Alert.prompt) and Android(Dialog).
Use the same way as AlertIOS.prompt
, simply just change Alert.prompt to prompt.
Screenshots
Installation
# with npm
npm install @rogermiret/react-native-prompt
# with yarn
yarn add @rogermiret/react-native-prompt
React Native >= v0.60
you don't need to link anything.
React Native < v0.60, Manual linking
react-native link @rogermiret/react-native-prompt
Example
import prompt from "@rogermiret/react-native-prompt";
const App = () => {
return (
<View>
<TouchableOpacity
onPress={() => {
prompt('Title', null, (input)=>{console.log(input)}));
}}>
<Text>Show Prompt 1</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
prompt(
'Title',
'Message',
setInput,
'secure-text',
'default value',
'numeric',
);
}}>
<Text>Show Prompt 2</Text>
</TouchableOpacity>
</View>
);
};
Options
Run Example Project
cd example
yarn install
yarn ios
yarn android
License
This project is licensed under the MIT License - see the LICENSE.md file for details