Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/turbo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ Note: available only on Android.

Enables debugging in the webview. Default value is `false`.

### `allowsInlineMediaPlayback`

Controls whether HTML5 videos and audio can play inline automatically without user interaction. Default value is `false`.

Note: available only on iOS.

### `stradaComponents`

`VisitableView` supports defining [Strada components](https://strada.hotwired.dev/) that receive and reply to messages from web components that are present on the page within one session. This prop accepts an array of Strada components that will be registered in the webview.
Expand Down
5 changes: 5 additions & 0 deletions packages/turbo/ios/RNVisitableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ class RNVisitableView: UIView, RNSessionSubscriber {
webViewConfiguration.applicationNameForUserAgent = applicationNameForUserAgent as? String
}
}
@objc var allowsInlineMediaPlayback: Bool = false {
didSet {
webViewConfiguration.allowsInlineMediaPlayback = allowsInlineMediaPlayback
}
}
@objc var pullToRefreshEnabled: Bool = true {
didSet {
controller!.visitableView.allowsPullToRefresh = pullToRefreshEnabled
Expand Down
1 change: 1 addition & 0 deletions packages/turbo/ios/RNVisitableViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ @interface RCT_EXTERN_MODULE(RNVisitableViewManager, NSObject)
RCT_EXPORT_VIEW_PROPERTY(contentInset, NSDictionary)
RCT_EXPORT_VIEW_PROPERTY(refreshControlTopAnchor, NSNumber)
RCT_EXPORT_VIEW_PROPERTY(webViewDebuggingEnabled, BOOL)
RCT_EXPORT_VIEW_PROPERTY(allowsInlineMediaPlayback, BOOL)
RCT_EXPORT_VIEW_PROPERTY(onVisitProposal, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onOpenExternalUrl, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onMessage, RCTDirectEventBlock)
Expand Down
1 change: 1 addition & 0 deletions packages/turbo/src/RNVisitableView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface RNVisitableViewProps {
progressViewOffset?: ProgressViewOffsetObject;
refreshControlTopAnchor: number;
webViewDebuggingEnabled: boolean;
allowsInlineMediaPlayback: boolean;
onLoad?: (e: NativeSyntheticEvent<LoadEvent>) => void;
onMessage?: (e: NativeSyntheticEvent<MessageEvent>) => void;
onError?: (e: NativeSyntheticEvent<ErrorEvent>) => void;
Expand Down
3 changes: 3 additions & 0 deletions packages/turbo/src/VisitableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export interface Props {
progressViewOffset?: ProgressViewOffsetObject;
refreshControlTopAnchor?: number;
webViewDebuggingEnabled?: boolean;
allowsInlineMediaPlayback?: boolean;
renderLoading?: RenderLoading;
renderError?: RenderError;
onVisitProposal: (proposal: VisitProposal) => void;
Expand Down Expand Up @@ -90,6 +91,7 @@ const VisitableView = React.forwardRef<RefObject, React.PropsWithRef<Props>>(
progressViewOffset,
refreshControlTopAnchor = 0,
webViewDebuggingEnabled = false,
allowsInlineMediaPlayback = false,
renderLoading,
renderError,
onLoad,
Expand Down Expand Up @@ -231,6 +233,7 @@ const VisitableView = React.forwardRef<RefObject, React.PropsWithRef<Props>>(
progressViewOffset={progressViewOffset}
refreshControlTopAnchor={refreshControlTopAnchor}
webViewDebuggingEnabled={webViewDebuggingEnabled}
allowsInlineMediaPlayback={allowsInlineMediaPlayback}
onError={onErrorCombinedHandlers}
onVisitProposal={handleVisitProposal}
onMessage={handleOnMessage}
Expand Down