diff --git a/.gitignore b/.gitignore index 6e2a841596c..5ec6852b5e6 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ website/build/ sync-api-docs/generatedComponentApiDocs.js sync-api-docs/extracted.json + +scripts/lint-examples/out/ diff --git a/docs/accessibilityinfo.md b/docs/accessibilityinfo.md index 39fe88bcf58..6c819e37a35 100644 --- a/docs/accessibilityinfo.md +++ b/docs/accessibilityinfo.md @@ -13,8 +13,8 @@ Sometimes it's useful to know whether or not the device has a screen reader that ```SnackPlayer name=AccessibilityInfo%20Function%20Component%20Example&supportedPlatforms=android,ios -import React, { useState, useEffect } from "react"; -import { AccessibilityInfo, View, Text, StyleSheet } from "react-native"; +import React, {useState, useEffect} from 'react'; +import {AccessibilityInfo, View, Text, StyleSheet} from 'react-native'; const App = () => { const [reduceMotionEnabled, setReduceMotionEnabled] = useState(false); @@ -22,28 +22,24 @@ const App = () => { useEffect(() => { const reduceMotionChangedSubscription = AccessibilityInfo.addEventListener( - "reduceMotionChanged", + 'reduceMotionChanged', reduceMotionEnabled => { setReduceMotionEnabled(reduceMotionEnabled); - } + }, ); const screenReaderChangedSubscription = AccessibilityInfo.addEventListener( - "screenReaderChanged", + 'screenReaderChanged', screenReaderEnabled => { setScreenReaderEnabled(screenReaderEnabled); - } + }, ); - AccessibilityInfo.isReduceMotionEnabled().then( - reduceMotionEnabled => { - setReduceMotionEnabled(reduceMotionEnabled); - } - ); - AccessibilityInfo.isScreenReaderEnabled().then( - screenReaderEnabled => { - setScreenReaderEnabled(screenReaderEnabled); - } - ); + AccessibilityInfo.isReduceMotionEnabled().then(reduceMotionEnabled => { + setReduceMotionEnabled(reduceMotionEnabled); + }); + AccessibilityInfo.isScreenReaderEnabled().then(screenReaderEnabled => { + setScreenReaderEnabled(screenReaderEnabled); + }); return () => { reduceMotionChangedSubscription.remove(); @@ -54,24 +50,24 @@ const App = () => { return ( - The reduce motion is {reduceMotionEnabled ? "enabled" : "disabled"}. + The reduce motion is {reduceMotionEnabled ? 'enabled' : 'disabled'}. - The screen reader is {screenReaderEnabled ? "enabled" : "disabled"}. + The screen reader is {screenReaderEnabled ? 'enabled' : 'disabled'}. ); -} +}; const styles = StyleSheet.create({ container: { flex: 1, - alignItems: "center", - justifyContent: "center" + alignItems: 'center', + justifyContent: 'center', }, status: { - margin: 30 - } + margin: 30, + }, }); export default App; @@ -81,8 +77,8 @@ export default App; ```SnackPlayer name=AccessibilityInfo%20Class%20Component%20Example&supportedPlatforms=android,ios -import React, { Component } from 'react'; -import { AccessibilityInfo, View, Text, StyleSheet } from 'react-native'; +import React, {Component} from 'react'; +import {AccessibilityInfo, View, Text, StyleSheet} from 'react-native'; class AccessibilityStatusExample extends Component { state = { @@ -94,21 +90,21 @@ class AccessibilityStatusExample extends Component { this.reduceMotionChangedSubscription = AccessibilityInfo.addEventListener( 'reduceMotionChanged', reduceMotionEnabled => { - this.setState({ reduceMotionEnabled }); - } + this.setState({reduceMotionEnabled}); + }, ); this.screenReaderChangedSubscription = AccessibilityInfo.addEventListener( 'screenReaderChanged', screenReaderEnabled => { - this.setState({ screenReaderEnabled }); - } + this.setState({screenReaderEnabled}); + }, ); AccessibilityInfo.isReduceMotionEnabled().then(reduceMotionEnabled => { - this.setState({ reduceMotionEnabled }); + this.setState({reduceMotionEnabled}); }); AccessibilityInfo.isScreenReaderEnabled().then(screenReaderEnabled => { - this.setState({ screenReaderEnabled }); + this.setState({screenReaderEnabled}); }); } diff --git a/docs/actionsheetios.md b/docs/actionsheetios.md index a56f4629f9e..45a73e9f065 100644 --- a/docs/actionsheetios.md +++ b/docs/actionsheetios.md @@ -8,19 +8,19 @@ Displays native to iOS [Action Sheet](https://developer.apple.com/design/human-i ## Example ```SnackPlayer name=ActionSheetIOS&supportedPlatforms=ios -import React, { useState } from "react"; -import { ActionSheetIOS, Button, StyleSheet, Text, View } from "react-native"; +import React, {useState} from 'react'; +import {ActionSheetIOS, Button, StyleSheet, Text, View} from 'react-native'; const App = () => { - const [result, setResult] = useState("🔮"); + const [result, setResult] = useState('🔮'); const onPress = () => ActionSheetIOS.showActionSheetWithOptions( { - options: ["Cancel", "Generate number", "Reset"], + options: ['Cancel', 'Generate number', 'Reset'], destructiveButtonIndex: 2, cancelButtonIndex: 0, - userInterfaceStyle: 'dark' + userInterfaceStyle: 'dark', }, buttonIndex => { if (buttonIndex === 0) { @@ -28,9 +28,9 @@ const App = () => { } else if (buttonIndex === 1) { setResult(Math.floor(Math.random() * 100) + 1); } else if (buttonIndex === 2) { - setResult("🔮"); + setResult('🔮'); } - } + }, ); return ( @@ -44,12 +44,12 @@ const App = () => { const styles = StyleSheet.create({ container: { flex: 1, - justifyContent: "center" + justifyContent: 'center', }, result: { fontSize: 64, - textAlign: "center" - } + textAlign: 'center', + }, }); export default App; diff --git a/docs/activityindicator.md b/docs/activityindicator.md index 33e05f8d587..65202fce54a 100644 --- a/docs/activityindicator.md +++ b/docs/activityindicator.md @@ -13,8 +13,8 @@ Displays a circular loading indicator. ```SnackPlayer name=ActivityIndicator%20Function%20Component%20Example -import React from "react"; -import { ActivityIndicator, StyleSheet, Text, View } from "react-native"; +import React from 'react'; +import {ActivityIndicator, StyleSheet, Text, View} from 'react-native'; const App = () => ( @@ -28,13 +28,13 @@ const App = () => ( const styles = StyleSheet.create({ container: { flex: 1, - justifyContent: "center" + justifyContent: 'center', }, horizontal: { - flexDirection: "row", - justifyContent: "space-around", - padding: 10 - } + flexDirection: 'row', + justifyContent: 'space-around', + padding: 10, + }, }); export default App; @@ -44,8 +44,8 @@ export default App; ```SnackPlayer name=ActivityIndicator%20Class%20Component%20Example -import React, { Component } from "react"; -import { ActivityIndicator, StyleSheet, Text, View } from "react-native"; +import React, {Component} from 'react'; +import {ActivityIndicator, StyleSheet, Text, View} from 'react-native'; class App extends Component { render() { @@ -63,13 +63,13 @@ class App extends Component { const styles = StyleSheet.create({ container: { flex: 1, - justifyContent: "center" + justifyContent: 'center', }, horizontal: { - flexDirection: "row", - justifyContent: "space-around", - padding: 10 - } + flexDirection: 'row', + justifyContent: 'space-around', + padding: 10, + }, }); export default App; diff --git a/docs/alert.md b/docs/alert.md index a347205a57c..068599efcb1 100644 --- a/docs/alert.md +++ b/docs/alert.md @@ -17,56 +17,48 @@ This is an API that works both on Android and iOS and can show static alerts. Al ```SnackPlayer name=Alert%20Function%20Component%20Example&supportedPlatforms=ios,android -import React, { useState } from "react"; -import { View, StyleSheet, Button, Alert } from "react-native"; +import React, {useState} from 'react'; +import {View, StyleSheet, Button, Alert} from 'react-native'; const App = () => { const createTwoButtonAlert = () => - Alert.alert( - "Alert Title", - "My Alert Msg", - [ - { - text: "Cancel", - onPress: () => console.log("Cancel Pressed"), - style: "cancel" - }, - { text: "OK", onPress: () => console.log("OK Pressed") } - ] - ); + Alert.alert('Alert Title', 'My Alert Msg', [ + { + text: 'Cancel', + onPress: () => console.log('Cancel Pressed'), + style: 'cancel', + }, + {text: 'OK', onPress: () => console.log('OK Pressed')}, + ]); const createThreeButtonAlert = () => - Alert.alert( - "Alert Title", - "My Alert Msg", - [ - { - text: "Ask me later", - onPress: () => console.log("Ask me later pressed") - }, - { - text: "Cancel", - onPress: () => console.log("Cancel Pressed"), - style: "cancel" - }, - { text: "OK", onPress: () => console.log("OK Pressed") } - ] - ); + Alert.alert('Alert Title', 'My Alert Msg', [ + { + text: 'Ask me later', + onPress: () => console.log('Ask me later pressed'), + }, + { + text: 'Cancel', + onPress: () => console.log('Cancel Pressed'), + style: 'cancel', + }, + {text: 'OK', onPress: () => console.log('OK Pressed')}, + ]); return ( -