facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.91k stars 24.3k forks source link

React native share "tintColor" property not working on iOS per docs #41542

Open ChristopherGabba opened 11 months ago

ChristopherGabba commented 11 months ago

Description

Trying to change the color of the share menu on iOS per the docs https://reactnative.dev/docs/share and the color never changes. I've tried expo snack, in my own app, etc.

React Native Version

0.72.5

Output of npx react-native info

System: OS: macOS 14.0 CPU: (10) arm64 Apple M2 Pro Memory: 718.67 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.7.0 path: /opt/homebrew/bin/node Yarn: Not Found npm: version: 10.1.0 path: /opt/homebrew/bin/npm Watchman: version: 2023.09.04.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.12.1 path: /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms:

Steps to reproduce

Using exact same code in the react native share docs webpage with exception of adding tintColor:

Using iPhone 12 on iOS 16.6.1

import React from 'react';
import {Alert, Share, View, Button} from 'react-native';

const ShareExample = () => {
  const onShare = async () => {
    try {
      const result = await Share.share({
        message:
          'React Native | A framework for building native apps using React',
      }, { tintColor: "#000000" }
      );
      if (result.action === Share.sharedAction) {
        if (result.activityType) {
          // shared with activity type of result.activityType
        } else {
          // shared
        }
      } else if (result.action === Share.dismissedAction) {
        // dismissed
      }
    } catch (error: any) {
      Alert.alert(error.message);
    }
  };
  return (
    <View style={{marginTop: 50}}>
      <Button onPress={onShare} title="Share" />
    </View>
  );
};

export default ShareExample;

Snack, screenshot, or link to a repository

https://snack.expo.dev/@christophergabba/example

github-actions[bot] commented 11 months ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.72.7. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
ChristopherGabba commented 11 months ago

I can confirm after updating to 0.72.7 that the tintColor prop is still not functioning.. Thanks, Chris

jakex7 commented 11 months ago

After (too long) research, I found that tintColor was introduced a long time ago, before Apple's redesign introduced in iOS 13. It used to change the color of the Cancel button, but after Apple's redesign, it is no longer possible to change the colors there.

image

Image source: iOS and iPadOS 13: The MacStories Review

ChristopherGabba commented 11 months ago

@jakex7 Ah I see. I appreciate you digging and doing the research. It would appear that this property needs to be removed from docs. I noticed that Be.Real had a dark version of the share menu:

15AF050B-4F57-4A0D-9AE4-ECF5CB4E24A6_1_201_a

I was trying to replicate that in React Native... I wonder how they did it...

jakex7 commented 11 months ago

@ChristopherGabba On the native side, it is possible to force a dark theme of Share Sheet. In fact, I believe this should be introduced in react-native, just like userInterfaceStyle is in ActionSheetIOS and I'll try to make a pull request with that

ChristopherGabba commented 11 months ago

@jakex7 That would be awesome! Thanks a bunch for looking into this @jakex7!

github-actions[bot] commented 5 months ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

ChristopherGabba commented 5 months ago

@jakex7 Did this ever get fixed?