Skip to content

Commit ffcaef6

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Fix BorderExample Crash on Out of Tree Platforms (#32120)
Summary: 9b4f8e0#diff-ee44452e2deeb3a607e863852bb720518875b88c4e78ea7dc76805488bfb1818 added examples to the border test page using PlatformColor. An iOS specific instance was later conditioned to only iOS in f6d0f9d#diff-ee44452e2deeb3a607e863852bb720518875b88c4e78ea7dc76805488bfb1818 but one example remains that has values for Android, and iOS only. This causes a crash on at least RNW, since none of the PlatformColors are valid. This change addsa a fallback to black for unsupported platforms, and also adds a Windows PlatformColor for kicks (and marginal extra usefuleness). ## Changelog [Internal] [Fixed] - Fix BorderExample Crash on Out of Tree Platforms Pull Request resolved: #32120 Test Plan: Validated on RNTester on Windows. Reviewed By: yungsters Differential Revision: D30822765 Pulled By: lunaleaps fbshipit-source-id: 6b3e65204259205bb2f3c9153a2361d1decebe98
1 parent fc553ed commit ffcaef6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/rn-tester/js/examples/Border/BorderExample.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,12 @@ const styles = StyleSheet.create({
183183
},
184184
border15: {
185185
borderWidth: 10,
186-
borderColor: PlatformColor(
187-
'systemGray4',
188-
'@android:color/holo_orange_dark',
189-
),
186+
borderColor: Platform.select({
187+
ios: PlatformColor('systemGray4'),
188+
android: PlatformColor('@android:color/holo_orange_dark'),
189+
windows: PlatformColor('SystemAccentColorDark1'),
190+
default: 'black',
191+
}),
190192
},
191193
border16: {
192194
borderWidth: 10,

0 commit comments

Comments
 (0)