私自身、壁紙や癒し系の小さなアプリを個人開発で長く運用してきましたが、配布前の実機差分を軽く見たまま App Store や Google Play に出してしまい、レビュー欄で初めて不具合に気づいた苦い経験が何度もあります。共有リンクはその差分を「ストアに出す前」に拾える数少ない仕組みです。ここでは、リンクを配る前に潰しておきたい実機差分を、検証の優先順位とともに整理します。
import { useSafeAreaInsets } from 'react-native-safe-area-context';import { View } from 'react-native';export function ScreenContainer({ children }) { const insets = useSafeAreaInsets(); return ( <View style={{ flex: 1, paddingTop: insets.top, paddingBottom: insets.bottom, paddingLeft: insets.left, paddingRight: insets.right, }} > {children} </View> );}
権限は起動直後ではなく、価値を体験してもらった後に求めます。
import * as Notifications from 'expo-notifications';// 例: お気に入りを1件保存した直後など、文脈のある瞬間に呼ぶexport async function askNotificationWhenRelevant() { const current = await Notifications.getPermissionsAsync(); if (current.granted) return true; if (!current.canAskAgain) return false; // 二度目は OS が出さない const result = await Notifications.requestPermissionsAsync(); return result.granted;}
ディープリンクは、コールドスタートと起動中の両方を取りこぼさないように二系統で受けます。
import * as Linking from 'expo-linking';import { useEffect, useState } from 'react';export function useIncomingLink() { const [url, setUrl] = useState(null); useEffect(() => { // コールドスタート時の初期 URL Linking.getInitialURL().then((initial) => { if (initial) setUrl(initial); }); // 起動中に届くリンク const sub = Linking.addEventListener('url', (event) => setUrl(event.url)); return () => sub.remove(); }, []); return url;}