-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: PlatformColor crashes on iOS and Android (#1703)
Follow-up PR to #1561 fixing the problems mentioned there. Also fixing the wrong releasing introduced in 027b8c1
- Loading branch information
Showing
10 changed files
with
527 additions
and
708 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,49 @@ | ||
import React from 'react'; | ||
import { PlatformColor, Platform, Button } from 'react-native'; | ||
import { | ||
Svg, | ||
Circle, | ||
Rect, | ||
Text, | ||
TSpan | ||
} from 'react-native-svg'; | ||
|
||
const color = PlatformColor(Platform.select({ | ||
ios: 'label', | ||
android: '@android:color/primary_text_light', | ||
default: 'black', | ||
})) | ||
|
||
export default () => { | ||
const [test, setTest] = React.useState(50); | ||
|
||
return ( | ||
<Svg height="100" width="100"> | ||
<Circle | ||
cx="50" | ||
cy="50" | ||
r="45" | ||
stroke="blue" | ||
strokeWidth="2.5" | ||
fill="green" | ||
/> | ||
<Rect | ||
x="15" | ||
y="15" | ||
width="70" | ||
height="70" | ||
stroke="red" | ||
strokeWidth="2" | ||
fill="yellow" | ||
/> | ||
</Svg> | ||
<> | ||
<Svg height="100" width="100" color={color}> | ||
<Circle | ||
cx="50" | ||
cy="50" | ||
r={test} | ||
strokeWidth="2.5" | ||
fill={color} | ||
/> | ||
<Rect | ||
x="15" | ||
y="15" | ||
width="70" | ||
height="70" | ||
stroke="currentColor" | ||
strokeWidth="5" | ||
/> | ||
</Svg> | ||
<Svg height="300" width="300" fill="red"> | ||
<Text x={0} y={0} fontSize={20}> | ||
<TSpan dx={test} inlineSize={"100%"} fill="currentColor"> | ||
Testing word-wrap... Testing word-wrap... Testing word-wrap... Testing word-wrap... | ||
</TSpan> | ||
</Text> | ||
</Svg> | ||
<Button title="Click me" onPress={()=> setTest(test + 1)}/> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.