File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 4747 * Creates a JSI export function declaration
4848 */
4949#define JSI_EXPORT_FUNC (CLASS, FUNCTION ) \
50- {#FUNCTION, (jsi::Value (JsiHostObject::*)( \
50+ {#FUNCTION, (jsi::Value (JsiHostObject::*)( \
5151 jsi::Runtime & runtime, const jsi::Value &thisValue, \
5252 const jsi::Value *arguments, size_t )) & \
5353 CLASS::FUNCTION}
6565 * Creates a JSI export getter declaration
6666 */
6767#define JSI_EXPORT_PROP_GET (CLASS, FUNCTION ) \
68- {#FUNCTION, (jsi::Value (JsiHostObject::*)(jsi::Runtime & runtime)) & \
68+ {#FUNCTION, (jsi::Value (JsiHostObject::*)(jsi::Runtime & runtime)) & \
6969 CLASS::STR_CAT (STR_GET, FUNCTION)}
7070
7171/* *
8383 */
8484#define JSI_EXPORT_PROP_SET (CLASS, FUNCTION ) \
8585 {#FUNCTION, \
86- (void (JsiHostObject::*)(jsi::Runtime & runtime, const jsi::Value &)) & \
86+ (void (JsiHostObject::*)(jsi::Runtime & runtime, const jsi::Value &)) & \
8787 CLASS::STR_CAT (STR_SET, FUNCTION)}
8888
8989/* *
Original file line number Diff line number Diff line change @@ -105,10 +105,15 @@ class RNSkJsiViewApi : public RNJsi::JsiHostObject,
105105 if (name == " onSize" && isSharedValue (runtime, arguments[2 ])) {
106106 jsi::Object size (runtime);
107107 auto pd = _platformContext->getPixelDensity ();
108- size.setProperty (runtime, " width" ,
109- info->view ->getScaledWidth () / pd);
110- size.setProperty (runtime, " height" ,
111- info->view ->getScaledHeight () / pd);
108+ auto w = info->view != nullptr
109+ ? std::max (info->view ->getScaledWidth (), 0 )
110+ : 0 ;
111+ auto h = info->view != nullptr
112+ ? std::max (info->view ->getScaledHeight (), 0 )
113+ : 0 ;
114+
115+ size.setProperty (runtime, " width" , w / pd);
116+ size.setProperty (runtime, " height" , h / pd);
112117 arguments[2 ].asObject (runtime).setProperty (runtime, " value" , size);
113118 } else {
114119 info->props .insert_or_assign (
You can’t perform that action at this time.
0 commit comments