Skip to content

Commit dc61f10

Browse files
sriramramanifacebook-github-bot
authored andcommitted
Make ResourceDrawableIdHelper work with resource id
Reviewed By: fkgozali Differential Revision: D5636657 fbshipit-source-id: 251b8b495655abf83618922b86f710fa38b08317
1 parent 9c2a5cd commit dc61f10

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ResourceDrawableIdHelper.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ public int getResourceDrawableId(Context context, @Nullable String name) {
5555
}
5656
name = name.toLowerCase().replace("-", "_");
5757

58+
// name could be a resource id.
59+
try {
60+
return Integer.parseInt(name);
61+
} catch (NumberFormatException e) {
62+
// Do nothing.
63+
}
64+
5865
synchronized (this) {
5966
if (mResourceDrawableIdMap.containsKey(name)) {
6067
return mResourceDrawableIdMap.get(name);

0 commit comments

Comments
 (0)