-
public class ReactFindViewUtil
Finds views in React Native view hierarchies
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
ReactFindViewUtil.OnViewFoundListener
Callback to be invoked when a react native view has been found
public interface
ReactFindViewUtil.OnMultipleViewsFoundListener
Callback to be invoked when all react native views with geiven NativeIds have been found
-
Method Summary
Modifier and Type Method Description static View
findView(View root, String nativeId)
Finds a view that is tagged with {@param nativeId} as its nativeID prop under the {@param root} view hierarchy. static void
findView(View root, ReactFindViewUtil.OnViewFoundListener onViewFoundListener)
Finds a view tagged with {@param onViewFoundListener}'s nativeID in the given {@param root} view hierarchy. static void
addViewListener(ReactFindViewUtil.OnViewFoundListener onViewFoundListener)
Registers an OnViewFoundListener to be invoked when a view with a matching nativeID is found.Remove this listener using removeViewListener() if it's no longer needed. static void
removeViewListener(ReactFindViewUtil.OnViewFoundListener onViewFoundListener)
Removes an OnViewFoundListener previously registered with addViewListener(). static void
addViewsListener(ReactFindViewUtil.OnMultipleViewsFoundListener listener, Set<String> ids)
static void
removeViewsListener(ReactFindViewUtil.OnMultipleViewsFoundListener listener)
static void
notifyViewRendered(View view)
Invokes any listeners that are listening on this {@param view}'s native id -
-
Method Detail
-
findView
@Nullable() static View findView(View root, String nativeId)
Finds a view that is tagged with {@param nativeId} as its nativeID prop under the {@param root} view hierarchy. Returns the view if found, null otherwise.
- Parameters:
root
- root of the view hierarchy from which to find the view
-
findView
static void findView(View root, ReactFindViewUtil.OnViewFoundListener onViewFoundListener)
Finds a view tagged with {@param onViewFoundListener}'s nativeID in the given {@param root} view hierarchy. If the view does not exist yet due to React Native's async layout, a listenerwill be added. When the view is found, the {@param onViewFoundListener} will be invoked.
- Parameters:
root
- root of the view hierarchy from which to find the view
-
addViewListener
static void addViewListener(ReactFindViewUtil.OnViewFoundListener onViewFoundListener)
Registers an OnViewFoundListener to be invoked when a view with a matching nativeID is found.Remove this listener using removeViewListener() if it's no longer needed.
-
removeViewListener
static void removeViewListener(ReactFindViewUtil.OnViewFoundListener onViewFoundListener)
Removes an OnViewFoundListener previously registered with addViewListener().
-
addViewsListener
static void addViewsListener(ReactFindViewUtil.OnMultipleViewsFoundListener listener, Set<String> ids)
-
removeViewsListener
static void removeViewsListener(ReactFindViewUtil.OnMultipleViewsFoundListener listener)
-
notifyViewRendered
static void notifyViewRendered(View view)
Invokes any listeners that are listening on this {@param view}'s native id
-
-
-
-