How to use the react-native.findNodeHandle function in react-native

To help you get started, we’ve selected a few react-native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gre / react-native-view-shot / src / index.js View on Github external
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);
}
github este / este / packages / components / KeyboardNavigableView.tsx View on Github external
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;
  }, []);
github fugitivelabs / yote / mobile / Yote / js / resources / user / views / UpdateProfile.js View on Github external
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);
  }
github keshavkaul / react-native-sketch-view / index.js View on Github external
changeTool(toolId) {
    UIManager.dispatchViewManagerCommand(
      findNodeHandle(this),
      UIManager.RNSketchView.Commands.changeTool,
      [toolId],
    );
  }
github PSPDFKit / react-native / index.js View on Github external
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)
      );
    }
  };
github viromedia / viro / components / ViroFlexView.js View on Github external
async getTransformAsync() {
    return await NativeModules.VRTNodeModule.getNodeTransform(findNodeHandle(this));
  },
github manyun-tech / react-native-fullscreen-media-kit / library / MediaPlayerView.js View on Github external
_getMediaPlayerViewHandle() {
        return ReactNative.findNodeHandle(this.refs[RCT_MEDIA_PLAYER_VIEW_REF]);
    }
github Bit-Nation / BITNATION-Pangea-mobile / src / PangeaCore / UI / components / PrivateKeyTextInputContainer / index.js View on Github external
          onFocus={event => onFocus(index, findNodeHandle(event.target))}
          onChangeText={text => onChange(index, text)}
github Marwan01 / food-converter / node_modules / react-native-reanimated / src / createAnimatedComponent.js View on Github external
_attachPropUpdater() {
      const viewTag = findNodeHandle(this);
      NODE_MAPPING.set(viewTag, this);
      if (NODE_MAPPING.size === 1) {
        ReanimatedEventEmitter.addListener('onReanimatedPropsChange', listener);
      }
    }
github viromedia / viro / components / ViroNode.js View on Github external
setVelocity: function(velocity) {
    NativeModules.VRTNodeModule.setVelocity(findNodeHandle(this), velocity);
  },