### Start Metro Server for Example App Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/CONTRIBUTING.md Starts the Metro bundler to serve the example application. This is necessary for running the app on devices or simulators. ```bash yarn example start ``` -------------------------------- ### Install react-native-fast-squircle Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/README.md Install the library using npm and run pod install for iOS. This is the initial setup step for using the component. ```bash npm install react-native-fast-squircle cd ios && pod install && cd .. # iOS only ``` -------------------------------- ### Basic FastSquircleView Usage Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/README.md Demonstrates how to import and use the FastSquircleView component with basic styling and corner smoothing. This is a fundamental example for getting started. ```typescript import FastSquircleView from 'react-native-fast-squircle'; ``` -------------------------------- ### Run Example App on Android Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/CONTRIBUTING.md Builds and runs the example application on an Android device or emulator. ```bash yarn example android ``` -------------------------------- ### Run Example App on iOS Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/CONTRIBUTING.md Builds and runs the example application on an iOS simulator or device. ```bash yarn example ios ``` -------------------------------- ### Install with bun Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/README.md Install the react-native-fast-squircle package using bun. ```sh bun add react-native-fast-squircle ``` -------------------------------- ### Install react-native-fast-squircle Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/QUICK-REFERENCE.md Install the library using npm or yarn. For iOS, run `pod install`. For Expo, use `expo prebuild`. ```bash npm install react-native-fast-squircle # or yarn add react-native-fast-squircle # iOS setup cd ios && pod install && cd .. # Expo setup expo prebuild ``` -------------------------------- ### iOS Pod Install Command Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/README.md After installing the library, navigate to the ios directory and run pod install to link native dependencies for iOS. ```sh cd ios && pod install ``` -------------------------------- ### iOS Native Dependencies Setup Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/INTEGRATION-PATTERNS.md Install native dependencies for iOS projects using CocoaPods. ```bash cd ios && pod install && cd .. ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/CONTRIBUTING.md Run this command in the root directory to install all project dependencies using Yarn workspaces. ```bash yarn ``` -------------------------------- ### Complete Example with Props and Styling Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/QUICK-REFERENCE.md A comprehensive example showcasing the `FastSquircleView` with various props including `ref`, `style`, `cornerSmoothing`, `onPress`, and accessibility props. Includes custom styling and event handling. ```typescript import React, { useRef } from 'react'; import { StyleSheet, Text, View, GestureResponderEvent } from 'react-native'; import FastSquircleView, { type FastSquircleViewProps } from 'react-native-fast-squircle'; export const CompleteExample: React.FC = () => { const viewRef = useRef(null); const handlePress = (e: GestureResponderEvent) => { console.log('Pressed at:', e.nativeEvent.pageX, e.nativeEvent.pageY); }; return ( Press Me ); }; const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', }, button: { paddingHorizontal: 24, paddingVertical: 12, backgroundColor: '#007AFF', borderRadius: 16, justifyContent: 'center', alignItems: 'center', shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.25, shadowRadius: 3.84, elevation: 5, }, buttonText: { color: 'white', fontSize: 16, fontWeight: '600', }, }); ``` -------------------------------- ### Install with npm Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/README.md Install the react-native-fast-squircle package using npm. ```sh npm install react-native-fast-squircle ``` -------------------------------- ### Install and Launch React DevTools Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/TROUBLESHOOTING.md Install React DevTools globally and launch it to inspect your React Native component hierarchy and state. Ensure it's imported conditionally for development builds. ```bash npm install -g react-devtools react-devtools ``` ```typescript if (__DEV__) { import('react-devtools').catch(err => { console.log('DevTools error:', err); }); } ``` -------------------------------- ### Install CocoaPods Dependencies Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/example/README.md Before building the iOS app, install CocoaPods dependencies. Run 'bundle install' once to install the bundler, and 'bundle exec pod install' after updating native dependencies. ```sh bundle install bundle exec pod install ``` -------------------------------- ### Install with yarn Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/README.md Install the react-native-fast-squircle package using yarn. ```sh yarn add react-native-fast-squircle ``` -------------------------------- ### Start Metro Bundler Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/example/README.md Run this command from the root of your React Native project to start the Metro dev server. This is necessary for building and running your app. ```sh # Using npm npm start # OR using Yarn yarn start ``` -------------------------------- ### Responsive Squircle Sizing Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/API-OVERVIEW.md An example of creating a responsive FastSquircleView whose size adjusts based on window dimensions. ```typescript const { width } = useWindowDimensions(); const size = Math.min(width * 0.8, 300); ``` -------------------------------- ### Using useRef with FastSquircleView Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/QUICK-REFERENCE.md Example of how to use the `useRef` hook to get a reference to the FastSquircleView component. ```typescript const ref = useRef(null); ``` -------------------------------- ### Styled Squircle Container Example Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/API-OVERVIEW.md Demonstrates using FastSquircleView as a styled container with borders, shadows, and padding. ```typescript {/* Child content */} ``` -------------------------------- ### Build and Run iOS App Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/example/README.md Run this command to build and run your iOS application after Metro is running and CocoaPods dependencies are installed. ```sh # Using npm npm run ios # OR using Yarn yarn ios ``` -------------------------------- ### Package.json Exports Configuration Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/EXPORTS.md Configuration in package.json defining how the package's entry points are resolved. This setup ensures correct imports for development (source) and production (transpiled). ```json { "main": "./lib/module/index.js", "types": "./lib/typescript/src/index.d.ts", "exports": { ".": { "source": "./src/index.tsx", "types": "./lib/typescript/src/index.d.ts", "default": "./lib/module/index.js" }, "./package.json": "./package.json" } } ``` -------------------------------- ### FastSquircleView as a Button Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/QUICK-REFERENCE.md Example of using FastSquircleView to create a tappable button with custom styling and an onPress handler. ```typescript console.log('Pressed')} > Tap Me ``` -------------------------------- ### Basic Squircle Button Example Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/API-OVERVIEW.md A common pattern for creating a squircle-shaped button with an onPress handler. ```typescript console.log('Pressed')} > Press Me ``` -------------------------------- ### Basic Usage of FastSquircleView Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/EXPORTS.md Demonstrates how to render a FastSquircleView component with basic styling and corner smoothing. Ensure 'react-native-fast-squircle' is installed. ```typescript import FastSquircleView from 'react-native-fast-squircle'; import { StyleSheet } from 'react-native'; export default function App() { return ( ); } const styles = StyleSheet.create({ box: { width: 200, height: 200, backgroundColor: 'blue', borderRadius: 30, }, }); ``` -------------------------------- ### Check Expo and React Native Versions Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/TROUBLESHOOTING.md Verify compatibility by checking the installed versions of Expo CLI and React Native. ```bash expo --version react-native --version ``` -------------------------------- ### Using useState with FastSquircleView Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/QUICK-REFERENCE.md Example of using the `useState` hook to manage dynamic styles, such as background color. ```typescript const [color, setColor] = useState('blue'); ``` -------------------------------- ### Invalid cornerSmoothing Examples Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/API-OVERVIEW.md Shows examples of invalid cornerSmoothing prop values that will cause errors. ```typescript // These throw errors // Error! // Error! ``` -------------------------------- ### FastSquircleView as an Avatar Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/QUICK-REFERENCE.md Example of using FastSquircleView to display an avatar image with specific dimensions and background. ```typescript ``` -------------------------------- ### Valid cornerSmoothing Examples Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/API-OVERVIEW.md Illustrates valid values for the cornerSmoothing prop, including defaults and custom numbers between 0 and 1. ```typescript // These are valid // OK // OK // OK // OK (uses default 0.6) ``` -------------------------------- ### Using useCallback for Handlers with FastSquircleView Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/QUICK-REFERENCE.md Example of using `useCallback` to memoize event handlers, improving performance by preventing unnecessary re-renders. ```typescript const handlePress = useCallback(() => { setCount(prev => prev + 1); }, []); ``` -------------------------------- ### FastSquircleView with Ref Forwarding Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/api-reference/FastSquircleView.md Demonstrates using `useRef` to get a reference to the underlying native view for imperative control. The `handlePress` function logs the ref's current value. ```typescript import React, { useRef } from 'react'; import { View } from 'react-native'; import FastSquircleView from 'react-native-fast-squircle'; export default function App() { const viewRef = useRef(null); const handlePress = () => { // Ref can be used to access the underlying native view console.log('View ref:', viewRef.current); }; return ( ); } ``` -------------------------------- ### Dynamic Styling with State Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/STYLING-GUIDE.md Apply dynamic styles by updating component state. This example toggles background color and opacity based on a pressed state. ```typescript import { useState } from 'react'; import FastSquircleView from 'react-native-fast-squircle'; import { StyleSheet } from 'react-native'; const styles = StyleSheet.create({ squircle: { width: 200, height: 200, borderRadius: 30, }, }); export default function App() { const [isPressed, setIsPressed] = useState(false); return ( setIsPressed(!isPressed)} /> ); } ``` -------------------------------- ### Usage with Custom Props Extending FastSquircleViewProps Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/EXPORTS.md Example of defining a component that extends FastSquircleViewProps to include additional custom props. Ensure the FastSquircleView component receives the necessary props. ```typescript import { type FastSquircleViewProps } from 'react-native-fast-squircle'; interface MyComponentProps extends FastSquircleViewProps { label?: string; } const MyComponent: React.FC = ({ label, ...props }) => { return ( <> {label && {label}} ); }; ``` -------------------------------- ### Using useMemo for Performance with FastSquircleView Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/QUICK-REFERENCE.md Demonstrates using `useMemo` to optimize style calculations, especially when dependent on other state or props. ```typescript const style = useMemo(() => ({ width: 200, height: 200, backgroundColor: color, borderRadius: 30, }), [color]); ``` -------------------------------- ### Prebuild for Specific Platform Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/TROUBLESHOOTING.md Execute the prebuild command for a specific platform (iOS or Android) with the --clean flag to resolve platform-specific build issues. ```bash expo prebuild --platform ios --clean expo prebuild --platform android --clean ``` -------------------------------- ### Publish New Versions to npm Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/CONTRIBUTING.md Uses release-it to automate the process of bumping versions, creating tags, and publishing new releases to npm. ```bash yarn release ``` -------------------------------- ### Animated Squircle with Reanimated Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/INTEGRATION-PATTERNS.md Integrates FastSquircleView with react-native-reanimated for advanced animations. Ensure react-native-reanimated is installed. ```typescript import React, { useEffect } from 'react'; import { StyleSheet } from 'react-native'; import Animated, useSharedValue, useAnimatedStyle, withRepeat, withTiming, interpolate, Extrapolate, } from 'react-native-reanimated'; import FastSquircleView from 'react-native-fast-squircle'; // Note: This example assumes react-native-reanimated is installed // npm install react-native-reanimated export const ReanimatedSquircle: React.FC = () => { const rotation = useSharedValue(0); useEffect(() => { rotation.value = withRepeat( withTiming(360, { duration: 3000 }), -1, true ); }, []); const animatedStyle = useAnimatedStyle(() => { return { transform: [ { rotate: `${rotation.value}deg`, }, ], }; }); return ( ); }; const styles = StyleSheet.create({ container: { alignItems: 'center', justifyContent: 'center', }, squircle: { width: 200, height: 200, backgroundColor: 'blue', borderRadius: 30, }, }); ``` -------------------------------- ### Responsive Styling with useWindowDimensions Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/STYLING-GUIDE.md Implement responsive styling by using the `useWindowDimensions` hook to dynamically adjust component properties based on screen size. This ensures the component adapts to different devices and orientations. ```typescript import { useWindowDimensions, StyleSheet } from 'react-native'; import FastSquircleView from 'react-native-fast-squircle'; export default function App() { const { width, height } = useWindowDimensions(); const responsiveStyles = { size: Math.min(width * 0.8, 300), borderRadius: Math.min(width * 0.8, 300) * 0.15, padding: width > 400 ? 20 : 10, }; return ( ); } ``` -------------------------------- ### Expo Prebuild Command Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/README.md Run this command to prepare your Expo project for native code integration when using packages like react-native-fast-squircle. ```sh expo prebuild ``` -------------------------------- ### Verifying Podfile Configuration for iOS Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/TROUBLESHOOTING.md Ensure the `react-native-fast-squircle` package is correctly referenced in the `ios/Podfile`. This is crucial for native linking. ```ruby target 'YourApp' do # ... other pods pod 'react-native-fast-squircle', :path => '../node_modules/react-native-fast-squircle' end ``` -------------------------------- ### 2x2 Grid Layout with Fast Squircle Views Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/INTEGRATION-PATTERNS.md Demonstrates creating a 2x2 grid layout using FastSquircleView components with different background colors and consistent corner smoothing. Requires React and React Native. ```typescript import React from 'react'; import { StyleSheet, View } from 'react-native'; import FastSquircleView from 'react-native-fast-squircle'; export const SquircleGrid2x2: React.FC = () => { return ( ); }; const styles = StyleSheet.create({ grid: { padding: 16, gap: 12, }, row: { flexDirection: 'row', gap: 12, }, box: { flex: 1, aspectRatio: 1, borderRadius: 20, }, }); ``` -------------------------------- ### Use useMemo for Dynamic Styles Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/QUICK-REFERENCE.md Optimize the creation of dynamic styles by using `useMemo`. This ensures styles are recomputed only when their dependencies change. ```typescript const style = useMemo(() => ({ /* ... */ }), [deps]); ``` -------------------------------- ### Styling Layout for FastSquircleView Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/QUICK-REFERENCE.md Quick reference for common layout styles like flex, flexDirection, and alignment. ```typescript flex: 1 flexDirection: 'row' justifyContent: 'center' alignItems: 'center' gap: 12 ``` -------------------------------- ### Re-export Component and Type in Your Module Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/EXPORTS.md Example of re-exporting the FastSquircleView component and its types from your own module. This allows for custom naming and encapsulation. ```typescript // my-components.ts export { default as SquircleBox } from 'react-native-fast-squircle'; export type { FastSquircleViewProps as SquircleBoxProps } from 'react-native-fast-squircle'; ``` -------------------------------- ### Checking Android SDK Compatibility Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/TROUBLESHOOTING.md Verify that your Android SDK versions are compatible with the library. Incompatible SDKs can lead to build errors. ```bash android list targets sdkmanager --list ``` -------------------------------- ### Usage of FastSquircleView with Default Corner Smoothing Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/types.md Demonstrates how to use the FastSquircleView component with a default cornerSmoothing value. Ensure FastSquircleView and its types are imported. ```typescript import React from 'react'; import FastSquircleView, { type FastSquircleViewProps } from 'react-native-fast-squircle'; const MyCustomSquircle: React.FC = (props) => { return ( ); }; ``` -------------------------------- ### Minimal FastSquircleView Setup Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/INTEGRATION-PATTERNS.md Basic integration of FastSquircleView in a React Native component. Sets a default blue background and border radius. ```typescript import React from 'react'; import { StyleSheet, View } from 'react-native'; import FastSquircleView from 'react-native-fast-squircle'; export default function App() { return ( ); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', }, squircle: { width: 200, height: 200, backgroundColor: 'blue', borderRadius: 30, }, }); ``` -------------------------------- ### Use StyleSheet for Static Styles Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/STYLING-GUIDE.md For static styles, use `StyleSheet.create` to memoize styles, improving performance by avoiding unnecessary re-creations on each render. ```typescript // Good: Styles are memoized const styles = StyleSheet.create({ box: { width: 200, height: 200, backgroundColor: 'blue', borderRadius: 30, }, }); ``` -------------------------------- ### FastSquircleView as a Container Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/QUICK-REFERENCE.md Shows how to use FastSquircleView as a flexible container with padding and border radius. ```typescript {/* Container content */} ``` -------------------------------- ### Stacked Layout with Squircles Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/INTEGRATION-PATTERNS.md Demonstrates a stacked layout using multiple FastSquircleView components. Each squircle has a different background color. ```typescript import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import FastSquircleView from 'react-native-fast-squircle'; export const StackedSquircles: React.FC = () => { return ( ); }; const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', gap: 16, }, box: { width: 150, height: 150, borderRadius: 24, }, first: { backgroundColor: 'red' }, second: { backgroundColor: 'green' }, third: { backgroundColor: 'blue' }, }); ``` -------------------------------- ### Accessing View Reference with useRef Source: https://github.com/fbeccaceci/react-native-fast-squircle/blob/main/_autodocs/INTEGRATION-PATTERNS.md Utilize useRef to get a direct reference to the FastSquircleView component for imperative operations. This is necessary when you need to interact with the component's instance directly. ```typescript import React, { useRef } from 'react'; import { StyleSheet, View, Button, View as RNView } from 'react-native'; import FastSquircleView from 'react-native-fast-squircle'; export const RefExample: React.FC = () => { const viewRef = useRef(null); const handleGetRef = () => { if (viewRef.current) { console.log('View reference:', viewRef.current); // Can use ref for platform-specific operations if needed } }; return (