diff --git a/TestsExample/App.js b/TestsExample/App.js index 023cd38fb..a17e69df0 100644 --- a/TestsExample/App.js +++ b/TestsExample/App.js @@ -10,6 +10,7 @@ import Test2080 from './src/Test2080'; import PointerEventsBoxNone from './src/PointerEventsBoxNone'; import Test2071 from './src/Test2071'; import Test2089 from './src/Test2089'; +import Test2196 from './src/Test2196'; export default function App() { return ; diff --git a/TestsExample/src/Test2196.tsx b/TestsExample/src/Test2196.tsx new file mode 100644 index 000000000..d9ddecd29 --- /dev/null +++ b/TestsExample/src/Test2196.tsx @@ -0,0 +1,59 @@ +import * as React from 'react'; +import {View, Button, Text} from 'react-native'; +import Svg, {Circle} from 'react-native-svg'; +import {SvgCssUri} from 'react-native-svg/css'; + +const URIs = { + invalid: 'https://en.wikipedia.org/wiki/File:Vector-based_example.svg', + valid: + 'https://upload.wikimedia.org/wikipedia/commons/3/30/Vector-based_example.svg', +}; + +export default function App() { + const [uri, setUri] = React.useState(URIs.invalid); + + const handlePress = React.useCallback(() => { + const newUri = uri === URIs.valid ? URIs.invalid : URIs.valid; + setUri(newUri); + }, [uri]); + + const title = + uri === URIs.invalid + ? 'Render fallback due to invalid SVG' + : 'Render Valid SVG'; + + const buttonTitle = `Switch to ${ + uri === URIs.invalid ? 'valid' : 'invalid' + } SVG`; + + return ( + + {title} + + {}} + uri={uri} + width={100} + height={100} + fallback={ + + + + } + /> + +