Add motion to an iOS Fission app

Review a handover note in a built-in modal with optional motion, keeping confirmation independent of animation completion.
iOS

What you will build

Use widget-owned modal motion without making animation timing authoritative over the handover state.
Prepare a real note and confirm or cancel its review
Keep motion optional and off by default in this example
Distinguish the app motion choice from missing native iOS Reduce Motion synchronization
Motion can explain that a review dialog has opened, but it cannot be the thing which makes a note confirmed. If confirmation waits for an animation callback, an interrupted transition becomes a data problem.
We will build a handover-note review flow using Fission's built-in Modal and its motion preset. The reducer changes the state immediately. Motion presents that change, whilst focus, dismissal and dialog semantics remain the standard widget's responsibility.

Create the shared app

Complete iOS setup if needed.
cargo install cargo-fission
fission init ios-add-motion-to-an-ios-fission-app
cd ios-add-motion-to-an-ios-fission-app
fission add-target ios --project-dir .
cargo add serde_yaml
Keep the generated src/main.rs. Both normal native and Web entrypoints below start the same review flow.

Run the finished example

fission run --target ios --project-dir .

1. Choose widget-owned motion before writing custom tracks

The modal already has stable internal slots, enter/exit motion and a dismissal boundary. Rebuilding those with a positioned container and opacity timer would make the example longer whilst losing the widget's normal behavior.
The draft and open/closed flag are local UI state. A confirmed version is a snapshot in application state. Closing the dialog cancels review, not the draft; changing the draft later does not silently edit the already confirmed version.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"src/app.rs","value":"src-app-rs"},{"index":1,"label":"src/app/state.rs","value":"src-app-state-rs"},{"index":2,"label":"src/app/screen.rs","value":"src-app-screen-rs"},{"index":3,"label":"src/i18n.rs","value":"src-i18n-rs"},{"index":4,"label":"src/lib.rs","value":"src-lib-rs"},{"index":5,"label":"preview/lib.rs","value":"preview-lib-rs"},{"index":6,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"},{"index":7,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}]}
{"id":"fission-tabs-1","index":0,"label":"src/app.rs","value":"src-app-rs"}
mod screen;
pub mod state;
pub use screen::ReviewScreen;
pub use state::ReviewState;
{"id":"fission-tabs-1","index":1,"label":"src/app/state.rs","value":"src-app-state-rs"}
use fission::prelude::*;

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ReviewState {
    pub locale: Locale,
    pub animate: bool,
    pub approved_note: Option<String>,
}

impl Default for ReviewState {
    fn default() -> Self {
        Self {
            locale: Locale::from("en-US"),
            animate: false,
            approved_note: None,
        }
    }
}
impl GlobalState for ReviewState {}
{"id":"fission-tabs-1","index":2,"label":"src/app/screen.rs","value":"src-app-screen-rs"}
use super::state::ReviewState;
use fission::prelude::*;

fission_component! {
    pub ReviewScreen<ReviewState> {
        state {
            draft: String = String::new(),
            review_open: bool = false,
        }
    }
    view(screen, state, cx) {
        let tokens = &cx.view.env().theme.tokens;
    } => SafeArea(
        child: Scroll(
            child: Container(Column(gap: tokens.spacing.m, children: [
                Text(cx.tr("review.heading")).size(tokens.typography.heading2_size),
                Text(cx.tr("review.explanation")),
                Row(gap: tokens.spacing.s, children: [
                    Button(
                        child: Text(cx.tr("language.english")), key: "english",
                        on_press: reduce { state.locale = Locale::from("en-US"); },
                    ),
                    Button(
                        child: Text(cx.tr("language.spanish")), key: "spanish",
                        on_press: reduce { state.locale = Locale::from("es-ES"); },
                    ),
                ]),
                Button(
                    child: Text(if state.animate { cx.tr("review.motion_off") } else { cx.tr("review.motion_on") }),
                    key: "toggle-animation",
                    on_press: reduce { state.animate = !state.animate; },
                ),
                TextInput(
                    value: screen.draft.clone(), bind(on_input): to(screen.draft),
                    label: Some(TextContent::Key("review.note".into())),
                    multiline: true, keyboard_type: TextInputType::Multiline,
                ),
                Button(
                    child: Text(cx.tr("review.open")), key: "open-review",
                    disabled: screen.draft.trim().is_empty(),
                    on_press: reduce { screen.review_open = true; },
                ),
                if let Some(note) = &state.approved_note {
                    Column(gap: tokens.spacing.s, children: [
                        Text(cx.tr("review.approved")).weight(tokens.typography.font_weight_semibold),
                        Text(note.clone()),
                        Text(cx.tr("review.session")).color(tokens.colors.text_secondary),
                    ])
                },
                Modal(
                    title: cx.tr("review.dialog_title"),
                    is_open: screen.review_open,
                    motion: Some(if state.animate { ModalMotion::Default } else { ModalMotion::None }),
                    on_dismiss: reduce { screen.review_open = false; },
                    content: Column(gap: tokens.spacing.m, children: [
                        Text(screen.draft.clone()),
                        Text(cx.tr("review.dialog_help")),
                        Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
                            Button(
                                child: Text(cx.tr("review.keep_editing")), key: "keep-editing",
                                on_press: reduce { screen.review_open = false; },
                            ),
                            Button(
                                child: Text(cx.tr("review.confirm")), key: "confirm-note",
                                on_press: reduce {
                                    state.approved_note = Some(screen.draft.trim().to_owned());
                                    screen.review_open = false;
                                },
                            ),
                        ]),
                    ]),
                ),
            ]))
            .padding_all(tokens.spacing.l),
        ),
    )
}
{"id":"fission-tabs-1","index":3,"label":"src/i18n.rs","value":"src-i18n-rs"}
use fission::i18n::{Locale, TranslationBundle};
use fission::prelude::*;
use std::collections::HashMap;

pub fn create_env() -> Env {
    let mut env = Env::default();
    env.locale = Locale::from("en-US");
    for (locale, source) in [
        ("en-US", include_str!("../i18n/en-US.yaml")),
        ("es-ES", include_str!("../i18n/es-ES.yaml")),
    ] {
        let messages: HashMap<String, String> =
            serde_yaml::from_str(source).expect("valid review translations");
        env.i18n.add_bundle(TranslationBundle {
            locale: Locale::from(locale),
            messages,
        });
    }
    env
}

pub fn sync_env(state: &crate::app::ReviewState, env: &mut Env) {
    env.locale = state.locale.clone();
    env.widget_motion = if state.animate {
        WidgetMotion::Standard
    } else {
        WidgetMotion::Off
    };
    // Do not overwrite a host-supplied Reduced motion preference.
}
{"id":"fission-tabs-1","index":4,"label":"src/lib.rs","value":"src-lib-rs"}
pub mod app;
mod i18n;

use app::{ReviewScreen, ReviewState};
use fission::prelude::*;

#[cfg(not(any(target_arch = "wasm32", target_os = "android", target_os = "ios")))]
pub fn run_desktop() -> anyhow::Result<()> {
    DesktopApp::<ReviewState, _>::new(ReviewScreen)
        .with_env(i18n::create_env())
        .with_sync_env(i18n::sync_env)
        .run()
}

#[cfg(any(target_os = "android", target_os = "ios"))]
pub fn run_mobile() -> anyhow::Result<()> {
    MobileApp::<ReviewState, _>::new(ReviewScreen)
        .with_env(i18n::create_env())
        .with_sync_env(i18n::sync_env)
        .run()
}

#[cfg(target_os = "android")]
#[no_mangle]
fn android_main(app_handle: AndroidApp) {
    let _ = MobileApp::<ReviewState, _>::new(ReviewScreen)
        .with_env(i18n::create_env())
        .with_sync_env(i18n::sync_env)
        .run_with_android_app(app_handle);
}

#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn run_web() -> Result<(), wasm_bindgen::JsValue> {
    console_error_panic_hook::set_once();
    WebApp::<ReviewState, _>::new(ReviewScreen)
        .with_env(i18n::create_env())
        .with_sync_env(i18n::sync_env)
        .run()
        .map_err(|error| wasm_bindgen::JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":5,"label":"preview/lib.rs","value":"preview-lib-rs"}
mod app;
mod i18n;

use fission::prelude::*;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(start)]
pub fn run() -> Result<(), JsValue> {
    console_error_panic_hook::set_once();
    WebApp::<app::ReviewState, _>::new(app::ReviewScreen)
        .with_env(i18n::create_env())
        .with_sync_env(i18n::sync_env)
        .mount("#fission-web-mount")
        .run()
        .map_err(|error| JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":6,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"}
review.heading: "Review a handover note"
review.explanation: "Write a note, review it in a dialog and confirm the version you want to keep for this session. Animation is optional."
review.motion_off: "Turn interface animation off"
review.motion_on: "Enable interface animation"
review.note: "Handover note"
review.open: "Review this note"
review.dialog_title: "Review before confirming"
review.dialog_help: "Confirming keeps a snapshot in memory. It does not send the note to another person."
review.keep_editing: "Keep editing"
review.confirm: "Confirm this version"
review.approved: "Confirmed version"
review.session: "Kept for this session only; nothing has been sent or saved to disk."
language.english: "English"
language.spanish: "Español"
{"id":"fission-tabs-1","index":7,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}
review.heading: "Revisar una nota de relevo"
review.explanation: "Escribe una nota, revísala en un diálogo y confirma la versión que quieres conservar para esta sesión. La animación es opcional."
review.motion_off: "Desactivar la animación de la interfaz"
review.motion_on: "Activar la animación de la interfaz"
review.note: "Nota de relevo"
review.open: "Revisar esta nota"
review.dialog_title: "Revisar antes de confirmar"
review.dialog_help: "Confirmar conserva una copia en memoria. No envía la nota a otra persona."
review.keep_editing: "Seguir editando"
review.confirm: "Confirmar esta versión"
review.approved: "Versión confirmada"
review.session: "Conservada solo para esta sesión; no se ha enviado ni guardado nada en disco."
language.english: "Inglés"
language.spanish: "Español"
{"id":"fission-tabs-1"}
Write a note and review it with animation off. Dismiss the dialog, then reopen and confirm it. Edit the draft: the confirmed version should remain unchanged. Enable animation and repeat; the state transitions must mean exactly the same thing.
Show the app preview
Hide the app preview

2. Keep preference, presentation and completion separate

The app begins with its widget motion disabled. Enabling it selects ModalMotion::Default; disabling it selects ModalMotion::None. Env.widget_motion applies the same app choice to widgets whose motion has not been set explicitly. We leave Env.motion_preference alone, so a host-reported reduced-motion preference still takes precedence.
There is a current platform boundary worth stating clearly. Fission's Web shell reads prefers-reduced-motion, but the current native iOS shell does not synchronize the iOS Reduce Motion setting into Env.motion_preference. This example therefore provides an explicit in-app choice and defaults to no animation. Do not describe that as automatic native accessibility integration.
Confirmation does not depend on a duration or frame count. Its reducer copies the note and closes the dialog in the same synchronous transition. A closing animation may still be visible, but it is not an authority for whether the note was confirmed.
With animation enabled, quickly open and dismiss the dialog several times. Confirm once and inspect the result after the transition settles. No delayed callback should overwrite the draft, confirm twice or reopen the dialog.
Show the app preview
Hide the app preview

3. Verify interrupted and reduced-motion behavior on the target

fission doctor ios --project-dir .
fission devices --project-dir .
fission run --target ios --project-dir .
fission test --target ios --project-dir .
Select a simulator with the simulator guide. Check open, backdrop dismissal, explicit Keep editing and Confirm in both languages. Repeat at narrow widths and with longer notes, then background and resume the app during a transition. The final state must remain useful even if intermediate frames were never displayed.
On iOS, verify the app's no-animation choice directly; toggling the system Reduce Motion setting alone does not prove the currently missing native synchronization. On Web, test the browser's reduced-motion preference as well as the app toggle. These are separate evidence paths.
A launch smoke test does not inspect animation, focus restoration or interrupted transitions. Use a real rendered target and check those interactions before calling the workflow qualified. The example is session-only: a confirmed note is not a network delivery or disk save.