Skip to content
Merged
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
16 changes: 14 additions & 2 deletions front_end/panels/rn_welcome/RNWelcome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ type RNWelcomeOptions = {
export class RNWelcomeImpl extends UI.Widget.VBox implements SDK.TargetManager.SDKModelObserver<ReactNativeApplicationModel> {
private readonly options: RNWelcomeOptions;

private reactNativeVersion: string | undefined;

static instance(options: RNWelcomeOptions): RNWelcomeImpl {
if (!rnWelcomeImplInstance) {
rnWelcomeImplInstance = new RNWelcomeImpl(options);
Expand Down Expand Up @@ -96,9 +98,16 @@ export class RNWelcomeImpl extends UI.Widget.VBox implements SDK.TargetManager.S
}

private _updateReactNativeVersion(event: Common.EventTarget.EventTargetEvent<Protocol.ReactNativeApplication.MetadataUpdatedEvent>): void {
const {appDisplayName, deviceName, reactNativeVersion} = event.data;

if (reactNativeVersion != null) {
this.reactNativeVersion = reactNativeVersion;
this.render();
}

// Side-effect: Update window title
if (event.data.appDisplayName != null && event.data.deviceName != null) {
document.title = `${event.data.appDisplayName} (${event.data.deviceName}) - React Native DevTools`;
if (appDisplayName != null && deviceName != null) {
document.title = `${appDisplayName} (${deviceName}) - React Native DevTools`;
}
}

Expand Down Expand Up @@ -144,6 +153,9 @@ export class RNWelcomeImpl extends UI.Widget.VBox implements SDK.TargetManager.S
${i18nString(UIStrings.whatsNewLabel)}
</x-link>
</div>
${this.reactNativeVersion != null ? html`
<p class="rn-welcome-version">React Native: <code>${this.reactNativeVersion}</code></p>
` : null}
</header>
${showDocs ? html`
<section class="rn-welcome-docsfeed">
Expand Down
12 changes: 12 additions & 0 deletions front_end/panels/rn_welcome/rnWelcome.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@
border-right: 1px solid var(--color-details-hairline);
}

.rn-welcome-version {
position: fixed;
bottom: 0;
right: 8px;
margin-top: 24px;
padding: 4px 12px;
border-radius: 6px;
background-color: var(--color-background-hover-overlay);
color: var(--color-text-secondary);
font-size: 11px;
}

.rn-welcome-docsfeed {
display: flex;
flex-direction: column;
Expand Down