Skip to content

Commit

Permalink
update ios and android Apis examples with new standardize
Browse files Browse the repository at this point in the history
  • Loading branch information
luism3861 committed May 15, 2020
1 parent a25a60f commit b521671
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 14 deletions.
4 changes: 3 additions & 1 deletion docs/actionsheetios.md
Expand Up @@ -11,7 +11,7 @@ Displays native to iOS [Action Sheet](https://developer.apple.com/design/human-i
import React, { useState } from "react";
import { ActionSheetIOS, Button, StyleSheet, Text, View } from "react-native";
export default App = () => {
const App = () => {
const [result, setResult] = useState("🔮");
const onPress = () =>
Expand Down Expand Up @@ -50,6 +50,8 @@ const styles = StyleSheet.create({
textAlign: "center"
}
});
export default App;
```

# Reference
Expand Down
24 changes: 16 additions & 8 deletions docs/backhandler.md
Expand Up @@ -60,7 +60,7 @@ The following example implements a scenario where you confirm if the user wants
import React, { useEffect } from "react";
import { Text, View, StyleSheet, BackHandler, Alert } from "react-native";
export default function App() {
const App = () => {
useEffect(() => {
const backAction = () => {
Alert.alert("Hold on!", "Are you sure you want to go back?", [
Expand All @@ -87,7 +87,7 @@ export default function App() {
<Text style={styles.text}>Click Back button!</Text>
</View>
);
}
};
const styles = StyleSheet.create({
container: {
Expand All @@ -100,6 +100,8 @@ const styles = StyleSheet.create({
fontWeight: "bold"
}
});
export default App;
```

<block class="classical syntax" />
Expand All @@ -108,7 +110,7 @@ const styles = StyleSheet.create({
import React, { Component } from "react";
import { Text, View, StyleSheet, BackHandler, Alert } from "react-native";
export default class App extends Component {
class App extends Component {
backAction = () => {
Alert.alert("Hold on!", "Are you sure you want to go back?", [
{
Expand Down Expand Up @@ -139,7 +141,7 @@ export default class App extends Component {
</View>
);
}
}
};
const styles = StyleSheet.create({
container: {
Expand All @@ -152,6 +154,8 @@ const styles = StyleSheet.create({
fontWeight: "bold"
}
});
export default App;
```

<block class="endBlock syntax" />
Expand All @@ -177,7 +181,7 @@ Additionally `BackHandler.removeEventListener` can also be used to clear the eve
import React, { useEffect } from "react";
import { Text, View, StyleSheet, BackHandler, Alert } from "react-native";
export default function App() {
const App = () => {
const backAction = () => {
Alert.alert("Hold on!", "Are you sure you want to go back?", [
{
Expand All @@ -202,7 +206,7 @@ export default function App() {
<Text style={styles.text}>Click Back button!</Text>
</View>
);
}
};
const styles = StyleSheet.create({
container: {
Expand All @@ -215,6 +219,8 @@ const styles = StyleSheet.create({
fontWeight: "bold"
}
});
export default App;
```

<block class="classical syntax" />
Expand All @@ -223,7 +229,7 @@ const styles = StyleSheet.create({
import React, { Component } from "react";
import { Text, View, StyleSheet, BackHandler, Alert } from "react-native";
export default class App extends Component {
class App extends Component {
backAction = () => {
Alert.alert("Hold on!", "Are you sure you want to go back?", [
{
Expand Down Expand Up @@ -251,7 +257,7 @@ export default class App extends Component {
</View>
);
}
}
};
const styles = StyleSheet.create({
container: {
Expand All @@ -264,6 +270,8 @@ const styles = StyleSheet.create({
fontWeight: "bold"
}
});
export default App;
```

<block class="endBlock syntax" />
Expand Down
10 changes: 6 additions & 4 deletions docs/permissionsandroid.md
Expand Up @@ -67,8 +67,6 @@ const App = () => (
</View>
);
export default App;
const styles = StyleSheet.create({
container: {
flex: 1,
Expand All @@ -84,6 +82,8 @@ const styles = StyleSheet.create({
textAlign: "center"
}
});
export default App;
```

<block class="classical syntax" />
Expand Down Expand Up @@ -117,7 +117,7 @@ const requestCameraPermission = async () => {
}
};
export default class App extends Component {
class App extends Component {
render() {
return (
<View style={styles.container}>
Expand All @@ -126,7 +126,7 @@ export default class App extends Component {
</View>
);
}
}
};
const styles = StyleSheet.create({
container: {
Expand All @@ -143,6 +143,8 @@ const styles = StyleSheet.create({
textAlign: "center"
}
});
export default App;
```

<block class="endBlock syntax" />
Expand Down
4 changes: 3 additions & 1 deletion docs/settings.md
Expand Up @@ -11,7 +11,7 @@ title: Settings
import React, { useState } from "react";
import { Button, Settings, StyleSheet, Text, View } from "react-native";
export default App = () => {
const App = () => {
const [data, setData] = useState(Settings.get("data"));
const storeData = data => {
Expand Down Expand Up @@ -46,6 +46,8 @@ const styles = StyleSheet.create({
marginVertical: 12
}
});
export default App;
```

---
Expand Down
1 change: 1 addition & 0 deletions docs/toastandroid.md
Expand Up @@ -16,6 +16,7 @@ The 'showWithGravityAndOffset(message, duration, gravity, xOffset, yOffset)' met
import React from "react";
import { View, StyleSheet, ToastAndroid, Button } from "react-native";
import Constants from "expo-constants";
const App = () => {
const showToast = () => {
ToastAndroid.show("A pikachu appeared nearby !", ToastAndroid.SHORT);
Expand Down

0 comments on commit b521671

Please sign in to comment.