Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function captureRef(
view: number | ?View | Ref,
optionsObject?: Object
): Promise {
ensureModuleIsLoaded();
if (view && typeof view === "object" && "current" in view && view.current) {
// React.RefObject
view = view.current;
if (!view) {
return Promise.reject(new Error("ref.current is null"));
}
}
if (typeof view !== "number") {
const node = findNodeHandle(view);
if (!node) {
return Promise.reject(
new Error("findNodeHandle failed to resolve view=" + String(view))
);
}
view = node;
}
const { options, errors } = validateOptions(optionsObject);
if (__DEV__ && errors.length > 0) {
console.warn(
"react-native-view-shot: bad options:\n" +
errors.map(e => `- ${e}`).join("\n")
);
}
return RNViewShot.captureRef(view, options);
}
const getViewElement = useCallback((): HTMLElement | null => {
if (!viewRef.current) return null;
// Cast weird number to HTMLElement.
const node = findNodeHandle(viewRef.current) as HTMLElement | null;
return node;
}, []);
setTimeout(() => {
var scrollResponder = this.refs.myScrollView.getScrollResponder();
// var scrollResponder = scrollView.getScrollRef();
var offset = 130;
scrollResponder.scrollResponderScrollNativeHandleToKeyboard(
ReactNative.findNodeHandle(this.refs[refName]),
offset, // adjust depending on your contentInset
/* preventNegativeScrollOffset */ true
// false
);
}, 150);
}
changeTool(toolId) {
UIManager.dispatchViewManagerCommand(
findNodeHandle(this),
UIManager.RNSketchView.Commands.changeTool,
[toolId],
);
}
let promise = new Promise(function(resolve, reject) {
requestMap[requestId] = { resolve: resolve, reject: reject };
});
UIManager.dispatchViewManagerCommand(
findNodeHandle(this.refs.pdfView),
this._getViewManagerConfig("RCTPSPDFKitView").Commands
.getAllAnnotations,
[requestId, type]
);
return promise;
} else if (Platform.OS === "ios") {
return NativeModules.PSPDFKitViewManager.getAllAnnotations(
type,
findNodeHandle(this.refs.pdfView)
);
}
};
async getTransformAsync() {
return await NativeModules.VRTNodeModule.getNodeTransform(findNodeHandle(this));
},
_getMediaPlayerViewHandle() {
return ReactNative.findNodeHandle(this.refs[RCT_MEDIA_PLAYER_VIEW_REF]);
}
onFocus={event => onFocus(index, findNodeHandle(event.target))}
onChangeText={text => onChange(index, text)}
_attachPropUpdater() {
const viewTag = findNodeHandle(this);
NODE_MAPPING.set(viewTag, this);
if (NODE_MAPPING.size === 1) {
ReanimatedEventEmitter.addListener('onReanimatedPropsChange', listener);
}
}
setVelocity: function(velocity) {
NativeModules.VRTNodeModule.setVelocity(findNodeHandle(this), velocity);
},