### Start Local Development Server Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/README.md This command starts a local development server for the Docusaurus website. It opens a browser window and provides live reloading for most changes made to the project files. ```bash yarn start ``` -------------------------------- ### Initializing Project with React Native CLI Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/docs/02-Installation.md This command initializes a new React Native project named 'MyApp' using the specified boilerplate template. It leverages the React Native CLI to set up the project structure and dependencies. ```bash npx @react-native-community/cli@latest init MyApp --template @thecodingmachine/react-native-boilerplate ``` -------------------------------- ### Install Dependencies with Yarn Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/README.md This command installs all the necessary dependencies for the Docusaurus project using Yarn. It reads the `package.json` file and downloads the required packages. ```bash yarn ``` -------------------------------- ### Initializing React Native Project with Boilerplate Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/blog/2020-04-19-React-Native-Boilerplate-3.0.0.md These commands initialize a new React Native project using the specified boilerplate template, start the development server, and run the application on iOS and Android platforms. It leverages react-native-cli and custom templates for easy setup. ```Shell npx react-native init --template @thecodingmachine/react-native-boilerplate yarn start yarn ios yarn android ``` -------------------------------- ### Install Fastlane with RubyGems Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/docs/06-BetaBuild.md This command installs Fastlane using RubyGems, the package manager for Ruby. The `-NV` flags disable documentation generation and verbose output during installation. ```Shell $ sudo gem install fastlane -NV ``` -------------------------------- ### Build Static Website Content Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/README.md This command generates static content for the Docusaurus website and places it into the `build` directory. This content can then be served using any static content hosting service. ```bash yarn build ``` -------------------------------- ### Install Ruby using Homebrew Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/docs/06-BetaBuild.md This command installs Ruby using Homebrew, a package manager for macOS. Ruby is a dependency for Fastlane. ```Shell $ brew install ruby ``` -------------------------------- ### Install Xcode command line tools Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/docs/06-BetaBuild.md This command installs the latest Xcode command line tools, which are required for Fastlane to function correctly. ```Shell $ xcode-select --install ``` -------------------------------- ### Starting Metro Bundler Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/README.md This command starts the Metro bundler, which is a JavaScript bundler that transforms and bundles the application's code for use on a mobile device or simulator. It needs to be run in a dedicated terminal. ```JavaScript yarn start ``` -------------------------------- ### Automate Certificate and Provisioning Profile Generation Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/docs/06-BetaBuild.md This Fastlane snippet automates the process of generating certificates and provisioning profiles for iOS code signing. It retrieves or creates certificates and provisioning profiles, installs them, and updates the project settings in Xcode. ```ruby get_certificates( # Create or get certificate, and install it output_path: "./builds" # Download certificate in the build folder (you don't need to create the folder) ) get_provisioning_profile( # Create or get provisioning profile output_path: "./builds", # Download provisioning profile in the build folder filename: "provisioning.mobileprovision" # Rename the local provisioning profile ) update_project_provisioning( # Set the project provisioning profile (related in Xcode to the General > Signing Release section) xcodeproj: "Boilerplate.xcodeproj", target_filter: "Boilerplate", # Name of your project profile: "./builds/provisioning.mobileprovision", build_configuration: "Release" ) update_project_team( # Set the right team on your project teamid: CredentialsManager::AppfileConfig.try_fetch_value(:team_id) ) ``` -------------------------------- ### Creating a Service to Fetch Application Settings (TS) Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/docs/04-Guides/02-Data Fetching.md This code snippet shows how to create a service function that fetches application settings from an API endpoint using a pre-configured HTTP client instance. The function uses the `instance.get` method to make a GET request to the `/settings` endpoint and returns a promise that resolves with the response data. ```ts import { instance } from '@/services/instance'; export default async () => instance.get(`/settings`); ``` -------------------------------- ### ErrorBoundary Usage Example Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/docs/04-Guides/08 - Components/05 - ErrorBoundary.md Demonstrates how to use the ErrorBoundary component to wrap a component and provide a fallback UI in case of errors. It imports the ErrorBoundary component and renders it with a fallback prop and a child component. ```jsx import { ErrorBoundary } from "@/components/atoms"; Something went wrong}> ``` -------------------------------- ### Using Skeleton Component with React Query Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/docs/04-Guides/08 - Components/03 - Skeleton.md This example demonstrates how to use the Skeleton component with a React Query hook to display a loading animation while fetching data. The Skeleton component takes a loading prop that determines whether to show the loading animation or the actual content. The component also accepts children, which are the content to be displayed when loading is false. ```jsx import { AssetByVariant, IconByVariant, Skeleton } from '@/components/atoms'; function Example() { const fetchOneUserQuery = useFetchOneQuery(currentId); // fetchOneUserQuery is a react-query query return ( {user.name} ); } export default Example; ``` -------------------------------- ### Using SafeScreen Component with Error Handling in React Native Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/docs/04-Guides/08 - Components/06 - SafeScreen.md This example demonstrates how to use the SafeScreen component to wrap content and handle errors from a data fetching query. It uses the isError prop to determine if an error occurred and the onResetError prop to refetch the data and reset the error state. ```JSX import { useI18n, useUser } from '@/hooks'; import { SafeScreen } from '@/components/templates'; function Example() { const { useFetchOneQuery } = useUser(); const fetchOneUserQuery = useFetchOneQuery(1); return ( // your content here ); } ``` -------------------------------- ### Changing Theme Variant with useTheme Hook in React Native Source: https://github.com/thecodingmachine/react-native-boilerplate/blob/main/documentation/docs/04-Guides/04-Theming/01-Using.md This code snippet illustrates how to change the current theme variant using the `useTheme` hook in a React Native component. It imports the `useTheme` hook and retrieves the `changeTheme` function. The `changeTheme` function is then called with the desired theme variant ('dark' in this example) when the button is pressed. ```tsx import { useTheme } from '@/theme'; const Example = () => { const { changeTheme } = useTheme(); return (